public class Time implements Runnable{
	private long starttime, stoptime;
	int diff;
	String diffString;
	Window window;

	private static final int timecount = 60;
	static int lefttime;

	private boolean runflg = true;

	public Time(Window w){
		window = w;
	}

	public void run(){
		while (runflg) {
			diff = difftime();
			//diffString = String.valueOf(diff);
			// 58にしておく。実際は0
			//window.l3.setText(diffString);

			if (diff == 0) {
				window.setVisible(false);
				new Window();
				break;
			}
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

	public void startTime() {
		starttime = System.currentTimeMillis();
	}

	public int difftime() {
		stoptime = System.currentTimeMillis();
		int passtime=(timecount - ((int) (stoptime - starttime)) / 1000);
		lefttime=passtime;
		return passtime;
	}

	public void fin(){
		runflg = false;
	}

}
